package com.ruoyi.teach.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teach.mapper.TeachStudentTagMapper;
import com.ruoyi.teach.domain.TeachStudentTag;
import com.ruoyi.teach.service.ITeachStudentTagService;

/**
 * 学生标签Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-21
 */
@Service
public class TeachStudentTagServiceImpl implements ITeachStudentTagService
{
    @Autowired
    private TeachStudentTagMapper teachStudentTagMapper;

    /**
     * 查询学生标签
     *
     * @param id 学生标签主键
     * @return 学生标签
     */
    @Override
    public TeachStudentTag selectTeachStudentTagById(Long id)
    {
        return teachStudentTagMapper.selectTeachStudentTagById(id);
    }

    @Override
    public List<TeachStudentTag> selectTeachStudentTagStudentId(Long id) {
        return teachStudentTagMapper.selectTeachStudentTagByStudentId(id);
    }

    /**
     * 查询学生标签列表
     *
     * @param teachStudentTag 学生标签
     * @return 学生标签
     */
    @Override
    public List<TeachStudentTag> selectTeachStudentTagList(TeachStudentTag teachStudentTag)
    {
        return teachStudentTagMapper.selectTeachStudentTagList(teachStudentTag);
    }
    /**
     * 查询学生标签列表
     *
     * @param studentId 学生标签
     * @return 学生标签
     */
    @Override
    public List<TeachStudentTag> selectTeachStudentTagList(long studentId)
    {
        TeachStudentTag studentTag = new TeachStudentTag();
        studentTag.setStudentId(studentId);
        return selectTeachStudentTagList(studentTag);
    }

    /**
     * 新增学生标签
     *
     * @param teachStudentTag 学生标签
     * @return 结果
     */
    @Override
    public int insertTeachStudentTag(TeachStudentTag teachStudentTag)
    {
        teachStudentTag.setCreateTime(DateUtils.getNowDate());
        String id = UUID.randomUUID().toString();
        teachStudentTag.setTagId(id.substring(0, 11));
        return teachStudentTagMapper.insertTeachStudentTag(teachStudentTag);
    }

    /**
     * 修改学生标签
     *
     * @param teachStudentTag 学生标签
     * @return 结果
     */
    @Override
    public int updateTeachStudentTag(TeachStudentTag teachStudentTag)
    {
        teachStudentTag.setUpdateTime(DateUtils.getNowDate());
        return teachStudentTagMapper.updateTeachStudentTag(teachStudentTag);
    }

    /**
     * 批量删除学生标签
     *
     * @param ids 需要删除的学生标签主键
     * @return 结果
     */
    @Override
    public int deleteTeachStudentTagByIds(Long[] ids)
    {
        return teachStudentTagMapper.deleteTeachStudentTagByIds(ids);
    }

    /**
     * 删除学生标签信息
     *
     * @param id 学生标签主键
     * @return 结果
     */
    @Override
    public int deleteTeachStudentTagById(Long id)
    {
        return teachStudentTagMapper.deleteTeachStudentTagById(id);
    }

    @Override
    public int deleteTeachStudentTagByTagId(String tagId)
    {
        return teachStudentTagMapper.deleteTeachStudentTagByTagId(tagId);
    }
}
